package com.ch.fastbuilder.transaction;

public class DynamicDataSourceHolder {
	public static final ThreadLocal<String> holder = new ThreadLocal<String>();
	public static final ThreadLocal<Boolean> springManager = new ThreadLocal<Boolean>();

    public static void setDataSource(String name) {
        holder.set(name);
        System.out.println("=========="+name+"============");
        springManager.set(true);
    }

    public static String getDataSouce() {
        return holder.get();
    }
    
    public static void clear() {
    	holder.remove();
    	springManager.remove();
    }
    
    public static Boolean isSpringManager() {
    	Boolean isSpring = springManager.get();
    	if(isSpring == null) return false;
    	
    	return isSpring;
    }
}
